<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.util.*,java.sql.*" %>
<%@page import="com.opensymphony.xwork2.ognl.OgnlValueStack"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'main.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<meta name="keywords" content="keyword1,keyword2,keyword3">
	<meta name="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  <body>
  <%
  	java.util.Date  now  =  new  java.util.Date(107,12,23,13,23,24);
  	String date=new Timestamp(System.currentTimeMillis()).toString().substring(0,10);
	pageContext.setAttribute("now",now);
  	request.setAttribute("date",date);
  	//操作OgnlValueStack
  	OgnlValueStack valueStack=null;
  	valueStack=(OgnlValueStack)request.getAttribute("struts.valueStack");
  	//if(valuesStack.findString("name")!=null){
  	//	valueStack.setValue("name","20");
  	//}
  	out.print(valueStack.findValue("name"));
	%>
<strong>日期:</strong><br/>
  方式一：<s:date name="#attr.now" format="yyyy-MM-dd" /><br/>
  方式二：不仅将date对象放入StrutsRequestWrapper对象属性中，同时也放在了ognl上下文（context Map容器）中，具体就是分别放在了key值为request的map容器和 key值为attr的map容器
   <%=request.getAttribute("date")%>或者<s:property value="#attr.date"/>或者<s:property value="#request.date"/><br/>
 方式三：<input type="text" value="<s:date name='new java.util.Date()' format='yyyy-MM-dd' />"/>
 <s:property value="name"/><br/>
 <s:property value="'字符串常量'+name"/><br/>
  	<s:set name="ddd" value="8*8" scope="request"/>
  	<s:set name="deptSort" value="new java.lang.String[]{'区质监局','税务分局','统计局'}"/>
 方式三：    <s:property value="#request.ddd"/>或者${requestScope.ddd}或者<%=request.getAttribute("ddd") %>或者${request.ddd}
    <br/>该方法获取struts2的StrutsRequestWrapper对象,该对象封装了原始的HttpServletRequest
    <%=pageContext.getRequest().toString() %>
    <br/>ServletContext上下文
    <%=application.toString()%>
    <br/>用于将OGNL表达式的值压入栈顶,top表示栈顶元素
    <s:push value="'how'"><s:property value="top"/></s:push>
    <s:property value="top.name"/>
    <br/>
 方式四：  <s:bean name="java.util.Date" var="myBean">
		<s:date name="#myBean" format="yyyy-MM-dd"/>
	</s:bean>

    
    <SCRIPT type="text/javascript">
    	document.write("<br/><span><s:date name="new java.util.Date()" format="yyyy-MM-dd"/></span>");
    	document.write("<br/><span>上下文根路径：${pageContext.request.contextPath}</span>");
    </SCRIPT>
    <s:debug></s:debug>
    <s:fielderror></s:fielderror>
  </body>
</html>
